package com.csweimei.rentmanagementtreasure.tenant.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProviders;

import com.chad.library.BR;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.base.AppViewModelFactory;
import com.csweimei.rentmanagementtreasure.databinding.LayoutFOneBinding;
import com.csweimei.rentmanagementtreasure.tenant.viewModel.FOneVM;
import com.csweimei.rentmanagementtreasure.weight.myProgressView.SemicircleProgressView;

import me.goldze.mvvmhabit.base.BaseFragment;

public class TabOneFragment extends BaseFragment<LayoutFOneBinding, FOneVM> {
    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.layout_f_one;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        super.initData();

        viewModel.setActivity(getActivity());
        viewModel.getHouseMsg("待收租");
        viewModel.selType.set("待收租");

        binding.tab1.setOnClickListener(v -> {
            binding.tabP.setBackgroundResource(R.mipmap.tab_1);
            viewModel.selType.set("待收租");
            viewModel.getHouseMsg("待收租");
        });

        binding.tab2.setOnClickListener(v -> {
            binding.tabP.setBackgroundResource(R.mipmap.tab_2);
            viewModel.selType.set("合同");
            viewModel.getHouseMsg("合同");
        });


        viewModel.setScheduleRecy(binding.scheduleRecy);

        viewModel.setPro(binding.pro);

    }


    @Override
    public FOneVM initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getActivity().getApplication());
        return ViewModelProviders.of(this,factory).get(FOneVM.class);
    }
}
